﻿using System.Collections.Generic;

namespace Expect.Vs2008.Extensions.LanguageService
{    
    public class Declarations : Microsoft.VisualStudio.Package.Declarations
    {
        IList<Expect.VisualStudio.Extensions.Declaration> declarations;
        public Declarations(IList<Expect.VisualStudio.Extensions.Declaration> declarations)
        {
            this.declarations = declarations;
        }

        public override int GetCount()
        {
            return declarations.Count;
        }

        public override string GetDescription(int index)
        {
            return declarations[index].Description;
        }

        public override string GetDisplayText(int index)
        {
            return declarations[index].DisplayText;
        }

        public override int GetGlyph(int index)
        {
            if (!declarations[index].Glyph.HasValue) return -1;

            return declarations[index].Glyph.Value;
        }

        public override string GetName(int index)
        {
            if (index >= 0)
                return declarations[index].Name;

            return null;
        }
    }
}
